package com.wuchao.service.serviceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.wuchao.entity.User;
import com.wuchao.mapper.UserMapper;
import com.wuchao.service.UserService;

import java.util.List;

/**
 * @Author wuchao66
 * @Date 2022/7/7 14:40
 * @Version 1.0
 */
@Service
public class UserServiceImpl implements UserService{

    @Resource
    private UserMapper userMapper;

    @Override
    public List<User> findUserByName(String name) {
        return userMapper.findUserByName(name);
    }
    @Override
    public PageInfo<User> findUserByPage(int currentPage, int pageSize, String name) {
        //1
        PageHelper.startPage(currentPage,pageSize);
        List<User> list = userMapper.findUserByName(name);
        PageInfo<User> pageInfo = new PageInfo<>(list);
        return   pageInfo;
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(User record) {
        return userMapper.insert(record);
    }

    @Override
    public int insertSelective(User record) {
        return userMapper.insertSelective(record);
    }

    @Override
    public User selectByPrimaryKey(Integer id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(User record) {
        return userMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(User record) {
        return userMapper.updateByPrimaryKey(record);
    }



}
